//
//  QKEasyAlbumTopBar.m
//  EasyIOS
//
//  Created by ChiCo on 2017/5/2.
//  Copyright © 2017年 EasyIOS. All rights reserved.
//

#import "QKEasyAlbumTopBar.h"

@implementation QKEasyAlbumTopBar

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self setBackgroundColor:[UIColor whiteColor]];
        //30 + 24
        self.backButton = ({
            UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
            [self addSubview:button];
            [button setFrame:CGRectMake(0, frame.size.height-44, 54, 44)];
            [button setImage:[UIImage imageNamed:@"icon_选择照片_back"] forState:UIControlStateNormal];
            button;
        });
        
        self.cancelButton = ({
            
            UILabel *label = [[UILabel alloc] init];
            [label setTextColor:[UIColor colorWithHexString:@"#999999"]];
            [label setText:@"取消"];
            [label setFont:[UIFont systemFontOfSize:14]];
            [self addSubview:label];
            [label mas_makeConstraints:^(MASConstraintMaker *make) {
                make.right.mas_equalTo(-15);
                make.centerY.equalTo(self.backButton.mas_centerY);
            }];
            
            UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
            [self addSubview:button];
            [button setFrame:CGRectMake(KScreenWidth-80,frame.size.height-44, 80, 44)];
          
            button;
        });
        
        self.titleLabel = ({
            UILabel *label = [[UILabel alloc] init];
            [label setFont:[UIFont systemFontOfSize:16]];
            [label setTextColor:[UIColor colorWithHexString:@"#333333"]];
            [label setText:@"全部照片"];
            [self addSubview:label];
            [label mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerX.mas_equalTo(0);
                make.centerY.mas_equalTo(self.backButton.mas_centerY);
            }];
            label;
        });
        
        UIView *line = [[UIView alloc] init];
        [self addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.right.mas_equalTo(0);
            make.bottom.mas_equalTo(0);
            make.height.mas_equalTo(1);
            
        }];
        [line setBackgroundColor:[UIColor colorWithHexString:@"#e9e9e9"]];
        
    }
    return self;
}

@end
